package com.frank.Aop;

import com.frank.vo.SysResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Frank
 * 全局异常处理机制,只拦截Controller层
 * advice 通知!!!
 */
@RestControllerAdvice
public class SystemException {

    /**指定异常的类型进行拦截.*/
    @ExceptionHandler(RuntimeException.class)
    public SysResult exception(Exception e){
        e.printStackTrace();
        //控制台打印异常201
        return SysResult.fail();
    }
}
